data <- read.csv("./Datasets/VehicleFailure.csv")
mycolors <- c("blue", "#FFC125", "darkgreen", "darkorange")

Interactive Data Visualization

Row

Car Failure Analysis

valueBox(paste("Failure"),
         color = "warning")

Failure

Car Failures in US

valueBox(length(data$State),
         icon = "fa-user")

1624

Labor Cost

gauge(round(mean(data$lc),
            digits = 2),
            min = 0,
            max = 350,
            gaugeSectors(success = c(0, 150),
                         warning = c(150, 240),
                         danger = c(240, 350),
                         colors = c("green", "yellow", "red")))

Massachusetts

valueBox(sum(data$State == "MA"),
         icon = 'fa-building')

21

California

valueBox(sum(data$State == "CA"),
         icon = 'fa-building')

200

Texas

valueBox(sum(data$State == "TX"),
         icon = 'fa-building')

293

Florida

valueBox(sum(data$State == "FL"),
         icon = 'fa-building')

168

Row

Failures By State

p1 <- data %>%
         group_by(State) %>%
         summarise(count = n()) %>%
         plot_ly(x = ~State,
                 y = ~count,
                 color = "blue",
                 type = 'bar') %>%
layout(xaxis = list(title = "Failures By State"), yaxis = list(title = 'Count'))
p1
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

Top States

p2 <- data %>%
         group_by(State) %>%
         summarise(count = n()) %>%
         filter(count>50) %>%
         plot_ly(labels = ~State,
                 values = ~count,
                 marker = list(colors = mycolors)) %>%
         add_pie(hole = 0.2) %>%
         layout(xaxis = list(zeroline = F,
                             showline = F,
                             showticklabels = F,
                             showgrid = F),
                yaxis = list(zeroline = F,
                             showline = F,
                             showticklabels=F,
                             showgrid=F))
p2

FM Vs Mileage

p3 <- plot_ly(data,
              x = ~fm,
              y = ~Mileage,
              text = paste("FM:", data$fm,
                           "Mileage:",
                           data$Mileage),
              type = "bar") %>%
         layout(xaxis = list(title="FM"),
                yaxis = list(title = "Failure Mileage"))
p3

Row

Scatter Plot of Month Vs Mileage

p4 <- plot_ly(data, x=~fm) %>%
         add_markers(y = ~Mileage,
                     text = ~paste("Mileage: ", Mileage),
                     showlegend = F) %>%
         add_lines(y = ~fitted(loess(Mileage ~ fm)),
                   name = "Loess Smoother",
                   color = I("#FFC125"),
                   showlegend = T,
                   line = list(width=5)) %>%
         layout(xaxis = list(title = "Month"),
                yaxis = list(title = "Mileage"))
p4

Box Plot of Top State

data %>%
         group_by(State) %>%
         ggvis(~State, ~lc, fill = ~State) %>%
         layer_boxplots()

Map

Map

car <- data %>%
         group_by(State) %>%
         summarize(total = n())
car$State <- abbr2state(car$State)

highchart() %>%
         hc_title(text = "Car Failures in US") %>%
         hc_subtitle(text = "Source: Vehiclefailure.csv") %>%
         hc_add_series_map(usgeojson, car,
                           name = "State",
                           value = "total",
                           joinBy = c("woename", "State")) %>%
         hc_mapNavigation(enabled = T)

Data Table

datatable(data,
          caption = "Failure Data",
          rownames = T,
          filter = "top",
          options = list(pageLength = 25))

Pivot Table

rpivotTable(data,
            aggregatorName = "Count",
            cols= "fm",
            rows = "State",
            rendererName = "Heatmap")

Summary

Column

Max Failure Month

valueBox(max(data$fm),
         icon = "fa-user" )

23

Average Labor cost

valueBox(round(mean(data$lc),
               digits = 2),
         icon = "fa-area-chart")

242.92

Average Mileage at Failure

valueBox(round(mean(data$Mileage), digits = 2),
         icon = "fa-area-chart")

20578.67

Column

Report

  • This is a report on 1624 car failures.

  • The average labor cost was 242.9180111.

  • The average material cost was 179.3948276.

This report was generated on March 08, 2021.

About Report

Created by: Data Scientist at ABC

Confidential: HIGHLY!